package com.pan.structual.bridge.utils;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

public enum DrawPicture {
    INSTANCE;
    {
        File file = new File("src\\main\\resources\\bridgePicture");
        if (file.exists() == false) file.mkdir();
    }

    public void drawByBufferedImage(BufferedImage image,String fileName){
        try {
            ImageIO.write(image,"jpg",
                    new File("src\\main\\resources\\bridgePicture\\"+fileName+".jpg")
                    );
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

    }
}
